{pagedown} Page Size & Margins

您所在的位置:网站首页 pagedown create paged html documents for {pagedown} Page Size & Margins

{pagedown} Page Size & Margins

2023-03-25 10:40| 来源: 网络整理| 查看: 265

{pagedown} Page Size & Margins

At Fathom Data we have been doing a lot of automated documentation and automated reporting. Although many of these documents are rendered to HTML, there’s an increasing demand for PDF documents. So we’ve had to raise out game in that department. The {pagedown} package has become invaluable. This is a short note showing how we tweak the page size and margins for PDF documents.

Output Format

The {pagedown} package comes with a selection of formats baked in. Each format is implemented as a function, for example:

html_paged() html_letter() and html_resume().

These functions are wrappers around a call to the generic function html_format(), which sets up the template, theme and CSS styling. The format is chosen via the output argument in the YAML header.

To make things as flexible as possible, we’ll create our own output format, fmtdoc(). We’ll come back to the details of that in a moment. Let’s first take a look at what a document using fmtdoc() would look like. Here’s a super simple document, document.Rmd, with a title and a single line of text.

--- title: "A test document" output: fmtdoc: extra_css: "page-parts.css" knit: pagedown::chrome_print --- This is the document.

Next we’ll implement fmtdoc(). It has one hard-coded style file, style.scss, and an optional argument, extra_css, which can be used to specify additional styling.

library(pagedown) fmtdoc


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3